﻿<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>添加商品</title>
    <link rel="stylesheet" href="<%=basePath %>web/css/from.css">
    <link rel="stylesheet" href="<%=basePath %>web/themes/default/easyui.css">
    <link rel="stylesheet" href="<%=basePath %>web/themes/icon.css">
    <script src="<%=basePath %>web/js/jquery.min.js"></script>
    <script src="<%=basePath %>web/js/jquery.easyui.min.js"></script>
    <script src="<%=basePath %>web/js/easyui-lang-zh_CN.js"></script>
    <script>
        $(function(){
        	$('#outtype').combobox({    
          		url:'/kxmanage/sellorderbill/findallpartname',    
          		valueField:'id',    
          		textField:'typeName'
       		}); 
       		$("#add").click(function(){
       			var form=$("#form").serializeArray();
       			var name=$("#typename").val();
       			if(name==null||name==''){
       				alert("类别名称不能为空");
       			}else{
       				$.ajax({
       					url:"/kxmanage/partdetail/check",
       					type:"post",
       					data:{"name":name},
       					dataType:"json",
       					success:function(data){
       						if(data.result=="success"){
       						  $.ajax({
       							url:"/kxmanage/partdetail/modify",
       							type:"post",
       							data:form,
       							dataType:"json",
       							success:function(data){
       								if(data.result=="success"){
       									alert("修改成功");
       									parent.addTabs('配件类别','goods/parttypedetail.jsp');
        								parent.closeTabs('配件类别信息');
       								}else if(data.result=="noPower"){
        								alert("您没有权限！");
        							}else{
       									alert("修改失败");
       								}
       							}
       						  });
       						}else{
       							alert("类别名称不能重复");
       						}
       					}
       				});
       			}
       		}); 
        });
        function loadadd(){
         	parent.addTabs("配件类别信息","goods/addparttypedetail.jsp");
         }
        function closeself(){
         	parent.closeTabs("配件类别信息");
        }
    </script>
    <style>
        body {
            font-size:12px;
            padding:10px
        }
        .l-table-edit {
           border-collapse:collapse;
           boreder-spacing:0
        }
        .l-table-edit-td {
            padding:4px;
            font-size:12px;
             border:#84a0c4 1px solid
        }
        
    </style>


</head>
<body>
<form name="form"  id="form" action="" method="post">
<input type="hidden" value="${parttype.code}" name="code">
    <table cellpadding="0"  cellspacing="0" class="l-table-edit" style="width:100%"  >
        <tr>
            <td width="17%" align="right" class="l-table-edit-td">现有类别（不能重复）：</td>
            <td align="left" class="l-table-edit-td">
            <select name="parenttype" id="outtype" class="easyui-combobox"  style="width:120px;height:30px" panelHeight="150px">
            
			</select></td>
            <td width="17%" align="right" class="l-table-edit-td">类别编号：</td>
            <td align="left" class="l-table-edit-td"><input class="easyui-textbox" name="id"  type="text" id="id" value="${parttype.ptid}" size="30" maxlength="50" ltype="text" readonly="readonly"/></td>
        </tr>
        <tr>
            <td width="17%" align="right" class="l-table-edit-td">类别名称：</td>
            <td align="left" class="l-table-edit-td"><input class="easyui-textbox" type="text" id="typename" name="typename" value="${parttype.typename}" size="30" maxlength="50" ltype="text" /></td>
            <td width="17%" align="right" class="l-table-edit-td">显示状态：</td>
            <td align="left" class="l-table-edit-td">
				<input type="radio" name="show" <c:if test="${parttype.show==1}">checked</c:if> value="1" />显示<input type="radio" name="show" <c:if test="${parttype.show==2}">checked</c:if> value="2" />隐藏
			</td>
        </tr>
        <tr>
        <td width="17%" align="right" class="l-table-edit-td">备注：</td>
            <td align="left" class="l-table-edit-td"><input class="easyui-textbox" type="text" id="memo" name="memo" value="${parttype.memo}" size="30" maxlength="50" ltype="text" /></td>
        
        </tr>
    </table>
</form>
<br>
<a href="javascript:loadadd()"><input  type="button" value="新   增" style="width:60px"></a>
<input  type="button" id="add" value="保存" style="width:60px" />
<input  type="button" value="审核" style="width:60px" />
<a href="javascript:closeself()"><input  type="button" value="关闭" style="width:60px"></a>


</body>
</html>